package org.particlethink.response;

import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import org.particlethink.entry.PlanStatus;
import org.particlethink.model.MasterPlan;
import org.particlethink.model.MasterPlanCategory;
import org.particlethink.model.Project;
import org.particlethink.model.ProjectUser;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Optional;

public class MasterPlanExportResponse {
    @ExcelProperty("管理层级")
    private String managementLevel; //管理层级
    @ExcelProperty("所属项目")
    private String projectName; //管理层级
    @ExcelProperty("总计划单号")
    private String no;
    @ExcelProperty("总计划大类")
    private String categoryName;

    @ExcelProperty("批次计划数")
    private Integer batchPlanCount;
    @ExcelProperty("提交时间")
    private String submitAt;//提交时间
    @ExcelProperty("提交人")
    private String submitUserName;//创建人
    @ExcelProperty("状态")
    private String status;
    @ExcelProperty("备注")
    private String remark;//备注


    public MasterPlanExportResponse(
            MasterPlan masterPlan,
            Project project,
            MasterPlanCategory category,
            ProjectUser submitUser
    ) {
        managementLevel = project.getManagementLevel();
        projectName = project.getName();
        no = masterPlan.getNo();
        categoryName = category.getName();
        batchPlanCount = masterPlan.getBatchPlanCount();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd");
        submitAt = masterPlan.getSubmitAt() == null ? "" : simpleDateFormat.format(masterPlan.getSubmitAt());
        submitUserName = submitUser == null ? "" : submitUser.getName();
        status = masterPlan.getStatus().toString();
        remark = masterPlan.getRemark();
    }


    public String getManagementLevel() {
        return managementLevel;
    }

    public void setManagementLevel(String managementLevel) {
        this.managementLevel = managementLevel;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public Integer getBatchPlanCount() {
        return batchPlanCount;
    }

    public void setBatchPlanCount(Integer batchPlanCount) {
        this.batchPlanCount = batchPlanCount;
    }


    public String getSubmitUserName() {
        return submitUserName;
    }

    public void setSubmitUserName(String submitUserName) {
        this.submitUserName = submitUserName;
    }


    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getSubmitAt() {
        return submitAt;
    }

    public void setSubmitAt(String submitAt) {
        this.submitAt = submitAt;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
}

